<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    body {
      width: 100vw;
      height: 100vh;
      font-size: 3em;
      padding: 30px;
      transition: 2s;
      display: flex;
      justify-content: center;
      align-items: center;
      background: #34495e;
      color: #34495e;
    }
    h1 {
      padding:30px;
      font-size: 30px;
    }
  </style>
</head>

<body>
  <h1>houdunren.com</h1>
  houdunren.com
  <script>
    function Color (elem) {
      this.elem = elem;
      this.colors = ["#74b9ff", "#ffeaa7", "#fab1a0", "#fd79a8"];
      this.run = function () {
        setInterval(
          function () {
            let pos = Math.floor(Math.random() * this.colors.length);
            this.elem.style.background = this.colors[pos];
          }.bind(this),
          1000
        );
      };
    }
    let obj = new Color(document.body);
    obj.run();
     new Color(document.querySelector("h1")).run();
  </script>
</body>

</html>